package com.landeb.shop.huo.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.landeb.shop.R;
import com.landeb.shop.huo.bean.BeanActShopDetail;

import java.util.List;

/**
 * Created by blade on 2017/6/30.
 */

public class ActShopDetailRvAdapter extends BaseQuickAdapter<BeanActShopDetail.DataBean.GoodsBean,BaseViewHolder> {

    private List<BeanActShopDetail.DataBean.GoodsBean> mList;
    private Context mContext;
    private LayoutInflater mInflater;

    public ActShopDetailRvAdapter(int layoutResId, List<BeanActShopDetail.DataBean.GoodsBean> data, Context context) {
        super(layoutResId, data);
        mList=data;
        mContext = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, BeanActShopDetail.DataBean.GoodsBean item) {


        helper.setText(R.id.title_item_fragHome_bottom_gridView, item.getTitle())
                .setText(R.id.price_item_fragHome_bottom_gridView,"¥"+ item.getPrice());

        Glide.with(mContext)
                .load(item.getPic())
                .placeholder(R.drawable.error_pic)
                .error(R.drawable.error_pic)
                .crossFade()
                .into((ImageView) helper.getView(R.id.imgV_item_fragHome_bottom_gridView));

    }
}
